home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 6 / Amiga Format AFCD06 (Nov 1996, Issue 90).iso / serious / commercial / xfa_devkit / xfa_library.doc < prev    next >
Text File  |  1996-08-19  |  40KB  |  1,469 lines

  1. ******************************************************************************
  2.  
  3.     XFA developer's kit, not for commercial use.
  4.     XFA.library Concept/Code/Design by Michele Puccini.
  5.  
  6.     All rights reserved by:
  7.     ClassX Development Italy
  8.     Via Francesca 463, I-56030 Montecalvoli (PI)
  9.     Tel: +39 587 749206
  10.     Fax: +39 587 749206
  11.     E-Mail: classx@pisoft.it (Michele Puccini)
  12.  
  13.     Feel free to contact us for any further information.
  14.  
  15. ******************************************************************************
  16.  
  17.     IMPORTANT:
  18.     This library is FreeWare, and NOT FOR COMMERCIAL PUPOSES.
  19.     If you write an application that makes use of this library, you
  20.     are kindly requested to let me know and to give me one copy of
  21.     what you've developed.
  22.     This library cannot be used for commercial products without written
  23.     permission of ClassX Development Italy.
  24.  
  25. ******************************************************************************
  26.  
  27. Standard Disclaimer
  28. *******************
  29.  
  30. THERE IS NO WARRANTY FOR THE SOFTWARE TO THE EXTENT PERMITTED BY APPLICABLE
  31. LAW.  EXCEPT WHERE OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
  32. OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
  33. EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  34. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE
  35. ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU.
  36. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  37. SERVICING, REPAIR OR CORRECTION.
  38.  
  39. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
  40. ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY REDISTRIBUTE THE SOFTWARE
  41. AS PERMITTED BELOW, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
  42. SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  43. INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
  44. DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
  45. OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
  46. SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  47. DAMAGES.
  48.  
  49. ******************************************************************************
  50. Introduction
  51.  
  52. - Another NON-STANDARD animation format, why ?
  53. Well, during the development of X-DVE, our titling/animation system, one of
  54. the first problems I had to face was to choose an animation format suited
  55. for video resolutions (meaning both PAL and NTSC) fast enough to play 
  56. smooth, even with high resolution and "deep" screens.
  57. I started to test the various standard animation formats, like Anim-5, Anim-7
  58. etc.
  59. They were all too slow to play and gave other extra features (like multiple
  60. palette handling, multi frame rates, complete multitasking) which I could 
  61. stand without.
  62. The only anim format very near to my requirements was SCALA's anim 32I, but:
  63. - there was no documentation for it.
  64. - it was smooth enough, but trying to swith caches off (68040) display
  65. started to flash, making me think of a bad double buffering tecnique.
  66. So, I decided to start working on a new compression tecnique (XFA) that
  67. now is in your hands.
  68.  
  69. - What kind of tecnique is used in XFA ?
  70. The tecnique is the classic "delta frame compression" that is normally used
  71. for anim-5, anim-7 formats.
  72.  
  73. XFA animations can be of 4 different kinds:
  74.  
  75. MODE                COMPRESSION                DISPLAY                    NOTE
  76. XFA_MODE16        16 bit                     ANY(forced to PAL)    right for disk play
  77. XFA_MODE32        32 bit                     ANY(forced to PAL)    right for disk play
  78. XFA_MODE16I     16 bit                     PAL/NTSC Lace
  79. XFA_MODE32I     32 bit                     PAL/NTSC Lace
  80.  
  81. While MODE16 and MODE32 can be played from disk and in any screen mode,
  82. MODE16I and MODE32I offers a better compression but can only be played
  83. in PAL or NTSC interlaced screens (this is what I need for VIDEO applications)
  84. The "I" modes are expressely developed to run at 50fps (PAL) and MUST run
  85. at 50fps (the only way to see smooth animations)
  86. The difference from anim-5/7 is that XFA deltas can be decompressed with a
  87. small (can be totally cached), fast and furious asm routine that outperforms
  88. any comparable standard decompression routine.
  89. Another difference is that, for "16I & 32I" modes, only half information
  90. is compressed for each frame, (nearly) doubling the decompression speed and 
  91. (nearly) halving the size of each delta.
  92. Displaying XFA "16I & 32I" mode animations, involves some low-level work
  93. with copper lists, in order to achieve a solid double buffering, even when
  94. the CPU is not fast enough to decompress deltas in synch with the vertical
  95. beam.
  96.  
  97. ******************************************************************************
  98. Call for Developers
  99.  
  100. This library has been developed to allow flexible access to XFA animations.
  101. PD programmers are strongly encouraged to use this library as it has a "human"
  102. programming approach and interesting (I hope) performances.
  103. I Hope to see talented PD programmers using this library for players,
  104. converters and other related applications.
  105. The first application I hope to see in the next months is a complete XFA
  106. datatype (........even if this will not give 50fps XFA's, it will be beautiful
  107. to have a (Multi)View of this kind of format in an intuition window !)
  108. Thank you for reading and supporting.
  109. Feel free to contact me for suggestions/improvements/questions.
  110. I MUST remember that XFA animations can be possible only thanks to Amiga
  111. custom chips and its fantastic OS (...that's the way it is, mr. big blue)
  112. Last-Last-Last:  Italy is full of great Amiga talents but I really want
  113. to make a special thank to Fabio Rotondo for writing XFA_Util2 (no more
  114. excuses, the docs are here, now it's on you !)
  115.  
  116.  
  117.     My banner:
  118.  
  119.      // 
  120.     \X/ Amiga. Computers for Thinking People
  121.        ------------------------------------
  122.  
  123.                                                                     Michele Puccini
  124.  
  125.  
  126.  
  127. Further note:
  128. Today, 19 Aug 1996 no one other than me is using this library, even if it is
  129. stable and fully working from v1.00.
  130. With the v1.15 it is only a little more reliable but the core code is still
  131. the same of v1.00.
  132. Dear developer, take a look at the example code and tell me why you are not
  133. using xfa.library.
  134.  
  135. ******************************************************************************
  136. Revision History
  137.  
  138. * v1.0 (23 Ago 1995)
  139. - First release, official X-DVE 2.0 compression library
  140.  
  141. * v1.1  (5 Apr 1996)
  142. - Added OSCAN_VIDEO flag to the screens opened with XFA_OpenPlayStuff()
  143.  
  144. * v1.10 (15 Apr 1996)
  145. - Added NTSC support to the library
  146.  
  147. * v1.12 (27 Mag 1996)
  148. - Better XFA_OpenPlayStuff(): now it shows the screen only when it is
  149.   fully initialized (no more flashes).
  150.  
  151. - Better XFA_Play(): bitmaps no more cleared at startup (they are already
  152.   cleared).
  153.  
  154. - Better sprite handling, now it is turned off in the right way.
  155.  
  156. - (FIX) XFA_MODE16 and XFA_MODE32 OpenPlayStuff() now works (it always failed,
  157.   leaving the screens opened (mea culpa !!)).
  158.  
  159. * v1.14 (19 Lug 1996)
  160. - XFA_Play() now supports slow motion play (25fps in PAL, 30fps in NTSC).
  161.   Blame me: I've modified the FD for XFA_Play()
  162.  
  163. - Finally sprites are tuned off correclty !
  164.  
  165. * v1.15 (9 Ago 1996)
  166. - Added support for Virtual Memory Manager.
  167.  
  168.  
  169. ******************************************************************************
  170. ToDo
  171.  
  172. - Allow the use of XFA_LibErr() to detect errors.
  173. - Multipalette handling.
  174. - Remove Disable()/Forbid() calls.
  175. - Better compression/speed (XFA2 ?)
  176. - DiskPlay.
  177. - AsynchIO for IFF handling.
  178.  
  179. ******************************************************************************
  180. CPU-68000 WARNING
  181.  
  182. Developer's package includes library versions compiled for 68000/20/30/40.
  183. Animations packed with 68020+ libraries CANNOT BE PLAYED on a standard
  184. 68000 cpu, because of data alignment restrictions (you'll get an address
  185. error).
  186. So, if you want to play XFA animations on a basic 68000 Amiga, you must
  187. compress them with xfa.library for 68000 processors, that automatically
  188. generates 68000-compatible anims.
  189. Note that 68020,030,040 libraries are equivalent in size and code (I use
  190. no FPU code inside, (and no 680x0 specific code...)).
  191.  
  192.  
  193. ******************************************************************************
  194. EXAMPLES AND SUPPORT CODE
  195.  
  196. The example code is written in BlitzII which is powerful, simple and very
  197. near to C (well, not too much....).
  198. I suppose there will be no problems for C coders to read and understand it.
  199. C include files are supplied in the appropriate drawer but I've no time to
  200. give them a better "Amiga-Library-Standard" look (help will be appreciated).
  201. BlitzII include file is "LIB_XFA.BB" and must be included everytime you want
  202. to use xfa.library.
  203. For BlitzII users there is also "xfa.library1" file that MUST be put into
  204. "Blitz2:blitzlibs/amigalibs" drawer, in order to get access to xfa.library
  205. functions (DefLibs MUST also be updated with the MakeDefLibs proggie).
  206.  
  207. ******************************************************************************
  208. SPEED DEMONS READ THIS
  209.  
  210. XFA is really an extra fast animation format and, if you believe in
  211. miracles, you will obtain 256 colours super-hires overscan 1472x566
  212. 50fps animations with pictures floating on the screen an a basic A1200 ;)
  213. This surely is the dream of everyone involved in video production.
  214. If XFA could do this, I could surely take the Nobel for Computer Science !
  215. You know that this is impossible to obtain from today's personal computers
  216. expecially if they don't have some hot chips inside.
  217. Amiga display chips, are really the best for video applications, but they
  218. have to be updated, just to follow today's users requirements.
  219. If they were light years away from the silly CGA, they now suffer of some
  220. bottlenecks (slow clock, cpu stealing, dma saturation).
  221. Now figure this:
  222. to play an animation at 50fps you have to unpack 1 frame every 1/50s.
  223. If the animation is a simple 640x512x4bpl resolution, the maximum thoughput
  224. you have to substain is 640/8 * 512 * 4 bytes per 1/50s (163840 bytes) or
  225. 8.192.000 bytes/s.
  226. If the same animation is a 768x566x8bpl resolution througput is 21.734.400
  227. bytes/s.
  228. If you have a 1472x566x8bpl maximum througput is 41.657.600 bytes/s.
  229. That's (nearly) all, but you have also to consider:
  230. - if the unpack code is in chip mem, it runs much slower than in fast
  231. - if the unpack data is in chip mem, it is accessed slower than in fast
  232. - the destination bitmaps MUST be in chip mem
  233. - the more the resolution displayed, the slower the cpu (video dma steals
  234.   cycles to cpu, and you cannot figure how much this is true in super-hires).
  235. The situation can surely improve if cpu and gfxchips have separate fast clocks
  236. and ........ but this is another story.
  237. The main point is that HOWEVER Amiga makes full screen animations possible
  238. while the others keep on dreaming in front of their waving stamp-size 160x160
  239. (pre)views.
  240.  
  241. ******************************************************************************
  242. NOTE
  243.  
  244. This is the documentation of the functions included in xfa.library.
  245. They will surely appear to you a little bit "sparse" and sometimes
  246. lacking.
  247. Remember that xfa.libary has been developed for X-DVE, and not for you,
  248. so please accept some limitations (but feel free to ask me).
  249. These library functions are not lamer-proof. This means that parameters
  250. passed to a function are intended to be safe and consistent.
  251. This library has been tested with MungWall and Enforcer under OS 3.0, OS 3.1,
  252. OS2.0 and OS 2.1.
  253. The techniques used in this library are completely system-friendly (except
  254. for the fast bitmap doublebuffering under OS2.0 / OS2.1: an incredible
  255. trick to change a ViewPort's BitMap using a single MrgCop (don't ask me how)).
  256. To be honest I used to peek some copper lists, but this is _for_sure_ safe
  257. even if not so smart.
  258.  
  259.                             LOOK MA' ... NO ENFORCER HITS !
  260.  
  261. Suggestion: Be OS-Friendly! OS3.0+ allows to do everything you want
  262.                 without low-level programming and headaches.
  263.  
  264.  
  265. ******************************************************************************
  266. ******************************************************************************
  267. ******************************************************************************
  268. ******************************************************************************
  269. ******************************************************************************
  270.  
  271. ------------------------------------------------------------------------------
  272.  
  273. FUNCTION:
  274.  
  275.     XFA_LibErr()
  276.  
  277. PROTO:
  278.  
  279.     LONG __asm __saveds LIBXFA_LibErr(void);
  280.  
  281. ACTION:
  282.  
  283.     Returns the error code of the last library function that caused an error.
  284.  
  285. ARGUMENTS:
  286.  
  287.  
  288. BUGS:
  289.     
  290.  
  291. NOTES:
  292.  
  293.     Not currenlty used from xfa library (maybe the next version)
  294.  
  295. ------------------------------------------------------------------------------
  296.  
  297. FUNCTION:
  298.  
  299.     XFA_PackMem_W(src0,src1,dest,size,mode)
  300.  
  301. PROTO:
  302.  
  303.     LONG __asm __saveds LIBXFA_PackMem_W(register __a0 UWORD * , register __a1 UWORD * , register __a2 UBYTE * , register __d0 LONG , register __d1 BOOL );
  304.  
  305. ACTION:
  306.  
  307.     Packs the differences of 2 chunks of memory in XFA format (16 bit).
  308.     Returns the size of compressed memory in bytes.
  309.  
  310. ARGUMENTS:
  311.  
  312.     src0 =    pointer to source memory 0
  313.     src1 =    pointer to source memory 1
  314.     dest =    pointer to destination user-allocated memory
  315.     size =    size of "src" memory chunk to be compressed
  316.     mode =    FALSE:
  317.                 evaluate compressed size (safe! : it will not write to dest)
  318.                 TRUE:
  319.                 compress memory and write packed data to dest
  320.             
  321. BUGS:
  322.  
  323.     
  324. NOTE:
  325.  
  326.     This is low level function, not sensible to packmode set by XFA_SetPack().
  327.  
  328. ------------------------------------------------------------------------------
  329.  
  330. FUNCTION:
  331.  
  332.     XFA_PackMem_L(src0,src1,dest,size,mode)
  333.  
  334. PROTO:
  335.  
  336.     LONG __asm __saveds LIBXFA_PackMem_L(register __a0 ULONG * , register __a1 ULONG * , register __a2 UBYTE * , register __d0 LONG , register __d1 BOOL );
  337.  
  338. ACTION:
  339.  
  340.     Packs the differences of 2 chunks of memory in XFA format (32 bit).
  341.     Returns the size of compressed memory in bytes.
  342.  
  343. ARGUMENTS:
  344.  
  345.     src0 =    pointer to source memory 0
  346.     src1 =    pointer to source memory 1
  347.     dest =    pointer to destination user-allocated memory
  348.     size =    size of "src" memory chunk to be compressed
  349.     mode =    FALSE:
  350.                 evaluate compressed size (safe! : it will not write to dest)
  351.                 TRUE:
  352.                 compress memory and write packed data to dest
  353.             
  354. BUGS:
  355.  
  356.     
  357. NOTE:
  358.  
  359.     this is low level function, not sensible to packmode set by XFA_SetPack()
  360.  
  361. ------------------------------------------------------------------------------
  362.  
  363. FUNCTION:
  364.  
  365.     XFA_PackBitMap(sbitmap0,sbitmap1,dest,mode)
  366.  
  367. PROTO:
  368.  
  369.     LONG __asm __saveds LIBXFA_PackBitMap(register __a0 struct BitMap * , register __a1 struct BitMap * , register __a2 void * , register __d0 BOOL );
  370.  
  371. ACTION:
  372.  
  373.     Packs the differences of 2 bitmaps in XFA format according to the actual
  374.     packmode set by XFA_SetPack().
  375.     Returns the size of compressed memory in bytes.
  376.  
  377. ARGUMENTS:
  378.  
  379.     sbitmap0 =    pointer to source bitmap 0
  380.     sbitmap1 =    pointer to source bitmap 1
  381.     dest =        pointer to destination user-allocated memory
  382.     mode =        FALSE:
  383.                     evaluate compressed size (safe! : it will not write to dest)
  384.                     TRUE:
  385.                     compress memory and write packed data to dest
  386.             
  387. BUGS:
  388.  
  389.     
  390. NOTE:
  391.  
  392.     Bitmaps MUST be width/height/depth identical.
  393.  
  394. ------------------------------------------------------------------------------
  395.  
  396. FUNCTION:
  397.  
  398.     XFA_UnPackBitMap_W(bitmap,pkdata)
  399.  
  400. PROTO:
  401.  
  402.     LONG __asm LIBXFA_UnPackBitMap_W(register __a0 struct BitMap *bm, register __a1 UBYTE *pkdata);
  403.  
  404. ACTION:
  405.  
  406.     Unpacks the XFA delta pkdata into a bitmap (16 bit).
  407.     Returns the address of the next byte past the end of pkdata.
  408.     
  409. ARGUMENTS:
  410.  
  411.     bitmap =    pointer to destination bitmap
  412.     pkdata =    pointer to XFA 16 bit packed delta
  413.             
  414. BUGS:
  415.  
  416.     
  417. NOTE:
  418.  
  419.     This is low level function, not sensible to packmode set by XFA_SetPack().
  420.     Destination bitmap MUST be widht/height/depth identical of the one packed
  421.     in pkdata.
  422.  
  423. ------------------------------------------------------------------------------
  424.  
  425. FUNCTION:
  426.  
  427.     XFA_UnPackBitMap_L(bitmap,pkdata)
  428.  
  429. PROTO:
  430.  
  431.     LONG __asm LIBXFA_UnPackBitMap_L(register __a0 struct BitMap *bm, register __a1 UBYTE *pkdata);
  432.  
  433. ACTION:
  434.  
  435.     Unpacks the XFA delta pkdata into a bitmap (32 bit).
  436.     Returns the address of the next byte past the end of pkdata.
  437.     
  438. ARGUMENTS:
  439.  
  440.     bitmap =    pointer to destination bitmap
  441.     pkdata =    pointer to XFA 32 bit packed delta
  442.             
  443. BUGS:
  444.  
  445.     
  446. NOTE:
  447.  
  448.     This is low level function, not sensible to packmode set by XFA_SetPack().
  449.     Destination bitmap MUST be widht/height/depth identical of the one packed
  450.     in pkdata.
  451.  
  452. ------------------------------------------------------------------------------
  453.  
  454. FUNCTION:
  455.  
  456.     XFA_UnPackBitMap(bitmap,pkdata)
  457.  
  458. PROTO:
  459.  
  460.     LONG __asm __saveds LIBXFA_UnPackBitMap(register __a0 struct BitMap * , register __a1 void * );
  461.     Returns the address of the next byte past the end of pkdata.
  462.  
  463. ACTION:
  464.  
  465.     Unpacks the XFA delta pkdata into a bitmap according to actual packmode.
  466.     
  467. ARGUMENTS:
  468.  
  469.     bitmap =    pointer to destination bitmap
  470.     pkdata =    pointer to XFA packed delta
  471.             
  472. BUGS:
  473.  
  474.     
  475. NOTE:
  476.  
  477.     Destination bitmap MUST be widht/height/depth identical of the one packed
  478.     in pkdata.
  479.  
  480. ------------------------------------------------------------------------------
  481.  
  482. FUNCTION:
  483.  
  484.     XFA_SetPack(screen,packmode)
  485.  
  486. PROTO:
  487.  
  488.     void __asm __saveds LIBXFA_SetPack(register __a0 struct Screen * , register __d0 LONG );
  489.  
  490. ACTION:
  491.  
  492.     Sets internal memory areas according to the screen settings.
  493.     Sets the pack mode for those library functions sensible to packmode.
  494.     Fills internal XFA_Head structure according to screen settings.
  495.     Fills internal XFA_CMap structure according to screen settings.
  496.     
  497. ARGUMENTS:
  498.  
  499.     screen =        pointer to screen that will contain the frames to be packed
  500.     packmode =    XFA_MODE#? packing mode used from library functions
  501.             
  502. BUGS:
  503.  
  504.     
  505. NOTE:
  506.  
  507.     This function MUST be called before starting any compression, because
  508.     it will set all the stuff needed for packing frames.
  509.     It can be called also during the packing, just to change XFA_CMap struct
  510.     (useful to make changes to palette without affecting the frames).
  511.     Due to speed and AGA display restrictions, screen's bitmap->BytesPerRow
  512.     MUST be multiple of 8 (pixel width multipe of 64).
  513.     It is NOT safe to change compression mode or screen during the packing.
  514.  
  515. ------------------------------------------------------------------------------
  516.  
  517. FUNCTION:
  518.  
  519.     XFA_GetPackMode()
  520.  
  521. PROTO:
  522.  
  523.     LONG __asm __saveds LIBXFA_GetPackMode(void);
  524.  
  525. ACTION:
  526.  
  527.     Returns the actual packmode used by the library (XFA_MODE#?).
  528.     
  529. ARGUMENTS:
  530.  
  531.             
  532. BUGS:
  533.  
  534.     
  535. NOTE:
  536.  
  537.  
  538. ------------------------------------------------------------------------------
  539.  
  540. FUNCTION:
  541.  
  542.     XFA_OpenPackStuff()
  543.  
  544. PROTO:
  545.  
  546.     BOOL __asm __saveds LIBXFA_OpenPackStuff(void);
  547.  
  548. ACTION:
  549.  
  550.     Allocates all the stuff needed for packing a sequence of frames.
  551.     This function also tries to allocate an internal pack buffer to
  552.     speedup the packing.
  553.     Returns TRUE if allocation is OK or FALSE if something failed.
  554.     
  555. ARGUMENTS:
  556.  
  557.             
  558. BUGS:
  559.  
  560.     
  561. NOTE:
  562.  
  563.     This function returns TRUE even if the pack buffer cannot be allocated,
  564.     because this will affect only the packing speed.
  565.     So, allocation of speedup buffer is transparent, but memory-hungry Amigas
  566.     will be surely slower on packing frames.
  567.  
  568. ------------------------------------------------------------------------------
  569.  
  570. FUNCTION:
  571.  
  572.     XFA_ClosePackStuff(closemode)
  573.  
  574. PROTO:
  575.  
  576.     void __asm __saveds LIBXFA_ClosePackStuff(register __d0 LONG );
  577.  
  578. ACTION:
  579.  
  580.     Frees all the stuff allocated by XFA_OpenPackStuff, including
  581.     the eventual pack buffer.
  582.     
  583. ARGUMENTS:
  584.  
  585.     closemode =    modality for closing the animation (CLOSE_#?)
  586.             
  587. BUGS:
  588.  
  589.     
  590. NOTE:
  591.  
  592.     It is safe to call this function, even if the pack stuff is not allocated.
  593.     Actually the animation can be closed in 2 ways:
  594.     CLOSE_BLANK:
  595.         this means that, playing the animation, it will show the last two frames
  596.         completely cleared.
  597.     CLOSE_LOOP
  598.         this means that the animation can loop continuously without any
  599.         visible jumps (ex: a spinning title).
  600.     This function will not return any value, even if it would be better to
  601.     notify the user about a possible failure in packing the last 2 frames.
  602.     Note that CLOSE_LOOP mode, cannot close XFA_MODEI animations correcly when
  603.     there is a odd number of frames in memory.
  604.     The reason for this is very simple, as XFA_MODEI animations work with
  605.     screens divided in odd/even frames and to loop such animations, frames
  606.     must match odd/even sequence every loop.
  607.     An example ?:
  608.  
  609.     incorrect sequence (odd number of frames):
  610.  
  611.     frame0    frame1    frame2    frame2    frame3
  612.     odd        even        odd        even        odd
  613.  
  614.     (error, next loop you'll get another odd frame)
  615.  
  616.  
  617.     correct sequence (even number of frames):
  618.  
  619.     frame0    frame1    frame2    frame2    
  620.     odd        even        odd        even
  621.  
  622.     (ok, next loop you'll get the right odd frame)
  623.  
  624.     
  625. ------------------------------------------------------------------------------
  626.  
  627. FUNCTION:
  628.  
  629.     XFA_SetFramesArray(framesarray,numframes)
  630.  
  631. PROTO:
  632.  
  633.     void __asm __saveds LIBXFA_SetFramesArray(register __a0 struct Mem * , register __d0 LONG );
  634.  
  635. ACTION:
  636.  
  637.     Tells the library to use an extenal frames array.
  638.         
  639. ARGUMENTS:
  640.  
  641.     framesarray =    pointer to an externally allocated frames array
  642.     numframes =     number of frames that can be handled from the library
  643.                         (and the size of the frames array)
  644.             
  645. BUGS:
  646.  
  647.     
  648. NOTE:
  649.  
  650.     This function can be used if you want to have a custom frames sequence
  651.     or multiple frames sequencies in memory.
  652.     You also must take care of eventual deallocation of the frames array,
  653.     as XFA_FreeFrames cannot be used for this purpose (well, you can use it
  654.     if you allocate the frames array with AllocVec, but its is a trick and
  655.     can cause future incompatibility problems).
  656.     This function overwrites internal frames array pointer, so take care of
  657.     it, or you'll loose memory and animations.
  658.  
  659. ------------------------------------------------------------------------------
  660.  
  661. FUNCTION:
  662.  
  663.     XFA_AllocFrames(numframes)
  664.  
  665. PROTO:
  666.  
  667.     struct Mem * __asm __saveds LIBXFA_AllocFrames(register __d0 LONG );
  668.  
  669. ACTION:
  670.  
  671.     Allocates a frames array for pack or play.
  672.     Returns the (struct Mem *) pointer to the frames array or NULL if
  673.     allocation failed.
  674.         
  675. ARGUMENTS:
  676.  
  677.     numframes =     number of frames that can be handled from the library
  678.                         (and the size of the frames array)
  679.             
  680. BUGS:
  681.  
  682.     
  683. NOTE:
  684.  
  685.     It is allowed to allocate multiple frames arrays with this function,
  686.     since it does not free the currently used one.
  687.     If using this feature you MUST remember all the allocations done, in order
  688.     to free them before exiting the program.
  689.     
  690. ------------------------------------------------------------------------------
  691.  
  692. FUNCTION:
  693.  
  694.     XFA_FreeFrames()
  695.  
  696. PROTO:
  697.  
  698.     void __asm __saveds LIBXFA_FreeFrames(void);
  699.  
  700. ACTION:
  701.  
  702.     Free all the currently used animation frames (linked to frames array)
  703.     and the frames array created with XFA_AllocFrames().
  704.         
  705. ARGUMENTS:
  706.  
  707.  
  708. BUGS:
  709.  
  710.     
  711. NOTE:
  712.  
  713.     It is safe to call this, even if there is no frames array.
  714.     If you have multiple frames arrays, allocated with XFA_AllocFrames(),
  715.     you have some possibilities to free them:
  716.     suppose you have anim1 and anim2 allocated with XFA_AllocFrames()
  717.  
  718.     1)
  719.     XFA_SetFramesArray(anim1,anim1frames);
  720.     XFA_FreeFrames();
  721.  
  722.     XFA_SetFramesArray(anim2,anim2frames);
  723.     XFA_FreeFrames();
  724.  
  725.     2)
  726.     XFA_SetFramesArray(anim1,anim1frames);
  727.     XFA_FreeAnim();
  728.     FreeVec(anim1); /* yes, you can, because XFA_AllocFrames() uses AllocVec() */
  729.  
  730.     XFA_SetFramesArray(anim2,anim2frames);
  731.     XFA_FreeAnim();
  732.     FreeVec(anim2); /* yes, you can, because XFA_AllocFrames() uses AllocVec() */
  733.     
  734. ------------------------------------------------------------------------------
  735.  
  736. FUNCTION:
  737.  
  738.     XFA_FreeAnim()
  739.  
  740. PROTO:
  741.  
  742.     void __asm __saveds LIBXFA_FreeAnim(void);
  743.  
  744. ACTION:
  745.  
  746.     Frees all the currently used animation frames (linked to frames array)
  747.     but leaves the frames array allocated.
  748.         
  749. ARGUMENTS:
  750.  
  751.  
  752. BUGS:
  753.  
  754.     
  755. NOTE:
  756.  
  757.     It is safe to call this, even if there is no frames array.
  758.  
  759. ------------------------------------------------------------------------------
  760.  
  761. FUNCTION:
  762.  
  763.     XFA_AnimMem()
  764.  
  765. PROTO:
  766.  
  767.     LONG __asm __saveds LIBXFA_AnimMem(void);
  768.     
  769. ACTION:
  770.  
  771.     Returns the size in bytes of the animation currently in memory.
  772.         
  773. ARGUMENTS:
  774.  
  775.  
  776. BUGS:
  777.  
  778.     
  779. NOTE:
  780.  
  781.     It is safe to call this, even if there is no frames array.
  782.  
  783. ------------------------------------------------------------------------------
  784.  
  785. FUNCTION:
  786.  
  787.     XFA_AnimFrames()
  788.  
  789. PROTO:
  790.  
  791.     LONG __asm __saveds LIBXFA_AnimFrames(void);
  792.  
  793.  
  794. ACTION:
  795.  
  796.     Returns the size in frames of the animation currently in memory.
  797.         
  798. ARGUMENTS:
  799.  
  800.  
  801. BUGS:
  802.  
  803.     
  804. NOTE:
  805.  
  806.     It is safe to call this, even if there is no frames array.
  807.  
  808. ------------------------------------------------------------------------------
  809.  
  810. FUNCTION:
  811.  
  812.     XFA_SaveAnim(filename)
  813.  
  814. PROTO:
  815.  
  816.     LONG __asm __saveds LIBXFA_SaveAnim(register __a0 char * );
  817.     
  818. ACTION:
  819.  
  820.     Save the animation held into current frames array in IFF-XFA format.
  821.     Returns 0 if OK or iff.library error code (IFFERR_#?).
  822.             
  823. ARGUMENTS:
  824.  
  825.     filename = complete path and filename of destination file
  826.  
  827. BUGS:
  828.  
  829.     
  830. NOTE:
  831.  
  832.  
  833. ------------------------------------------------------------------------------
  834.  
  835. FUNCTION:
  836.  
  837.     XFA_LoadAnim(filename,xfa_head,xfa_cmap,mode)
  838.  
  839. PROTO:
  840.  
  841.     LONG __asm __saveds LIBXFA_LoadAnim(register __a0 char * , register __a1 struct XFA_Head * , register __a2 struct XFA_CMap * , register __d0 BOOL );
  842.     
  843. ACTION:
  844.  
  845.     Multi function IFF-XFA load routine that allows to:
  846.     - check if filename is IFF-XFA
  847.     - load an animation into frames array
  848.     - load only xfa_head and xfa_cmap from an IFF-XFA animation
  849.     Returns 0 if OK or iff.library error code (IFFERR_#?).
  850.         
  851. ARGUMENTS:
  852.  
  853.     filename =    complete path and filename of source file
  854.     xfa_head =    pointer to user's allocated XFA_Head structure
  855.                     NULL to use internal library-allocated one.
  856.     xfa_cmap =    pointer to user's allocated XFA_CMap structure
  857.                     NULL to use internal library-allocated one.
  858.     mode =        TRUE to load the whole animation
  859.                     FALSE to load only xfa_head and xfa_cmap
  860.  
  861. BUGS:
  862.  
  863.     
  864. NOTE:
  865.  
  866.     If mode = TRUE, this function replaces any animation already in memory
  867.     issuing a XFA_FreeAnim() before loading the frames.
  868.     The animation will be loaded until there is space into frames-array
  869.     or in memory.
  870.     If you don't know the size (in frames) of the animation to be loaded,
  871.     it is a good thing to first get its xfa_head and allocate enogh frames
  872.     to load it all (reading the needed amount of frames from xfa_head->NFrames).
  873.     You can easily read the palette of an xfa animation simply putting your
  874.     own XFA_CMap pointer into the right parameter, before calling XFA_LoadAnim().
  875.     Note also that current packmode can be changed from this function, even if
  876.     it fails to load an animation.
  877.  
  878. ------------------------------------------------------------------------------
  879.  
  880. FUNCTION:
  881.  
  882.     XFA_PosOnFrame(frame)
  883.  
  884. PROTO:
  885.  
  886.     void __asm __saveds LIBXFA_PosOnFrame(register __d0 LONG );
  887.  
  888. ACTION:
  889.  
  890.     Inits internal buffers for subsequential XFA_PutFrame() calls.
  891.     Returns TRUE if OK or FALSE if it cannot init buffers (no memory or frame
  892.     out of range).
  893.         
  894. ARGUMENTS:
  895.  
  896.     frame = number of frame to position to
  897.  
  898. BUGS:
  899.  
  900.     
  901. NOTE:
  902.  
  903.     Please refer to examples.
  904.  
  905. ------------------------------------------------------------------------------
  906.  
  907. FUNCTION:
  908.  
  909.     XFA_PutFrame(frame)
  910.  
  911. PROTO:
  912.  
  913.     BOOL __asm __saveds LIBXFA_PutFrame(register __d0 LONG );
  914.  
  915. ACTION:
  916.  
  917.     Compresses the frame and puts it in the frames array.
  918.     Returns TRUE if OK or FALSE if it cannot compress the frame    (no memory
  919.     or frame out of range).
  920.         
  921. ARGUMENTS:
  922.  
  923.     frame = number of frame to work on
  924.  
  925. BUGS:
  926.  
  927.     
  928. NOTE:
  929.  
  930.     This function also prepares internal buffers for a subsequential call to
  931.     XFA_PutFrame(), so there's no need to issue a XFA_PosOnFrame() for each
  932.     frame.
  933.     This can be done only with sequential frames.
  934.     To put frames into the frames array randomly, a XFA_PosOnFrame(f) must
  935.     be issued before every XFA_PutFrame(f).
  936.     If packmode if 16BitI or 32BitI, extra unused rasterlines will be cleared
  937.     automatically before compressing the frame.
  938.     This is a litte example of how to pack two sequencies of frames:
  939.  
  940.     .
  941.     .
  942.     .
  943.     c = 6
  944.     XFA_PosOnFrame(c);
  945.     /* render here */
  946.     XFA_PutFrame(c); c++;
  947.     /* render here */
  948.     XFA_PutFrame(c); c++;
  949.     /* render here */
  950.     XFA_PutFrame(c); c++;
  951.     /* render here */
  952.     XFA_PutFrame(c); c++;
  953.     /* render here */
  954.     XFA_PutFrame(c); c++;
  955.     .
  956.     .
  957.     c = 40
  958.     XFA_PosOnFrame(c);
  959.     /* render here */
  960.     XFA_PutFrame(c); c++;
  961.     /* render here */
  962.     XFA_PutFrame(c); c++;
  963.     /* render here */
  964.     XFA_PutFrame(c); c++;
  965.     /* render here */
  966.     XFA_PutFrame(c); c++;
  967.     /* render here */
  968.     XFA_PutFrame(c); c++;
  969.     .
  970.     .
  971.  
  972.     Please refer to examples.
  973.  
  974. ------------------------------------------------------------------------------
  975.  
  976. FUNCTION:
  977.  
  978.     XFA_PutSkip(frame)
  979.  
  980. PROTO:
  981.  
  982.     BOOL __asm __saveds LIBXFA_PutSkip(register __d0 LONG );
  983.  
  984. ACTION:
  985.  
  986.     Puts a skip (no delta information) frame into the frames array.
  987.     Frees any other previous information in that frames array position.
  988.     Returns TRUE if OK or FALSE if it fails (no memory or frame out of
  989.     range).
  990.         
  991. ARGUMENTS:
  992.  
  993.     frame = number of frame to work on
  994.  
  995. BUGS:
  996.  
  997.     
  998. NOTE:
  999.  
  1000.     This function is used internally by X-DVE but can be useful to    init all
  1001.     the frames array with the predefined skip value for current pack screen.
  1002.     As definition, a skip frame will be ignored during decompression, even
  1003.     if it will be considered for timings as a delay of 1/50 of sec (1/60
  1004.     for NTSC).
  1005.  
  1006. ------------------------------------------------------------------------------
  1007.  
  1008. FUNCTION:
  1009.  
  1010.     XFA_IsSkip(frame)
  1011.  
  1012. PROTO:
  1013.  
  1014.     BOOL __asm __saveds LIBXFA_IsSkip(register __d0 LONG );
  1015.  
  1016. ACTION:
  1017.  
  1018.     Returns TRUE if the frame is a skip (ignore, no delta information) one.
  1019.         
  1020. ARGUMENTS:
  1021.  
  1022.     frame = number of frame to work on
  1023.  
  1024. BUGS:
  1025.  
  1026.     
  1027. NOTE:
  1028.  
  1029.     This function is used internally from X-DVE.
  1030.  
  1031. ------------------------------------------------------------------------------
  1032.  
  1033. FUNCTION:
  1034.  
  1035.     XFA_Play(loop,autopause,waitstart,slow)
  1036.  
  1037. PROTO:
  1038.  
  1039.     BOOL __asm __saveds LIBXFA_Play(register __d0 BOOL , register __d1 BOOL , register __d2 BOOL ,  register __d3 BOOL);
  1040.  
  1041. ACTION:
  1042.  
  1043.     Executes the animation stored in the frames array.
  1044.     Returns TRUE if ok or (only under OS3.0+) FALSE if it cannot allocate
  1045.     the required DBufInfo structure.
  1046.         
  1047. ARGUMENTS:
  1048.  
  1049.     loop =        Infinite loop mode.
  1050.                     TRUE: does an infinite loop play.
  1051.                     FALSE: does a single shot play.
  1052.  
  1053.     autopause = Pause mode.
  1054.                     TRUE: pauses the animation automatically everytime there are
  1055.                     no objects moving on the screen.
  1056.                     FALSE: executes the animation respecting the real animation
  1057.                     timings.
  1058.  
  1059.     waitstart =    User start mode.
  1060.                     TRUE: start to play only when the user clicks and releases
  1061.                     the left mouse button.
  1062.                     FALSE: starts to play immediately, without waiting.
  1063.  
  1064.     slow         =    Slow mode.
  1065.                     TRUE: The animation is played at half speed.
  1066.                     FALSE: The animation is playes at full speed.
  1067.  
  1068.  
  1069. BUGS:
  1070.  
  1071.     
  1072. NOTE:
  1073.  
  1074.     This function temporarily disables all the multitasking facilities of
  1075.     Amiga Operating System: Use with care.
  1076.     During the play, mouse buttons can be used as follows:
  1077.     Left Mouse Button:    start the animation
  1078.                                 restart from an autopause
  1079.                                 if autopause = false : pause execution until release
  1080.     Right Mouse Button:    exit the animation if in autopause
  1081.                                 if autopause = false and Left Mouse Button : exit the
  1082.                                 animation
  1083.  
  1084.     Rather complex to explain, intuitive during play.
  1085.  
  1086. ------------------------------------------------------------------------------
  1087.  
  1088. FUNCTION:
  1089.  
  1090.     XFA_UseHead(xfa_head)
  1091.  
  1092.  
  1093. PROTO:
  1094.  
  1095.     void __asm __saveds LIBXFA_UseHead(register __a0 struct XFA_Head * );
  1096.  
  1097. ACTION:
  1098.  
  1099.     'Uses' the supplied xfa_head settings.
  1100.         
  1101. ARGUMENTS:
  1102.  
  1103.     xfa_head =    pointer to user's XFA_Head structure
  1104.                     if NULL, use internally handled structure.
  1105.  
  1106. BUGS:
  1107.  
  1108.     
  1109. NOTE:
  1110.  
  1111.     This function is here for completeness, and can be modified in the next
  1112.     issues of the library.
  1113.     Actually it simply sets internal packmode according to XFA_Head.Flags
  1114.     bits.
  1115.     However, it can be used when you have multiple XFA_Head structures to refer
  1116.     to.
  1117.  
  1118. ------------------------------------------------------------------------------
  1119.  
  1120. FUNCTION:
  1121.  
  1122.     XFA_UseCMap(screen,xfa_cmap)
  1123.  
  1124. PROTO:
  1125.  
  1126.     void __asm __saveds LIBXFA_UseCMap(register __a0 struct Screen * , register __a1 struct XFA_CMap * );
  1127.  
  1128. ACTION:
  1129.  
  1130.     'Uses' supplied xfa_cmap settings on the screen.
  1131.         
  1132. ARGUMENTS:
  1133.  
  1134.     screen =     pointer to user's screen where XFA_CMap must be applied
  1135.                     if NULL, use destination XFA_SetPack() screen.
  1136.  
  1137.     xfa_cmap =    pointer to user's XFA_CMap structure
  1138.                     if NULL, use internally handled structure.
  1139.  
  1140. BUGS:
  1141.  
  1142.     
  1143. NOTE:
  1144.  
  1145.     This function is here for completeness, and can be modified in the next
  1146.     issues of the library.
  1147.     Actually it simply applies the palette in XFA_CMap to the screen.
  1148.     It is safe only to call this function inside a XFA_OpenPackStuff() - 
  1149.     XFA_ClosePackStuff(), and you must take care if the destination screen
  1150.     is opened.
  1151.     
  1152. ------------------------------------------------------------------------------
  1153.  
  1154. FUNCTION:
  1155.  
  1156.     XFA_OpenPlayStuff(wbmodeid)
  1157.  
  1158. PROTO:
  1159.  
  1160.     BOOL __asm __saveds LIBXFA_OpenPlayStuff(DREG0 BOOL wbmodeid);
  1161.  
  1162. ACTION:
  1163.  
  1164.     Allocates and inits all the stuff needed to play a sequence of frames,
  1165.     referring to the settings in XFA_Head, XFA_CMap internal structures.
  1166.     Returns TRUE if OK or FALSE if function fails to open the play screen
  1167.     and double buffering bitmaps.
  1168.             
  1169. ARGUMENTS:
  1170.  
  1171.     wbmodeid =    force a wb-like screen
  1172.                     TRUE: open play stuff forcing the output on a workbench-like
  1173.                     mode id.
  1174.                     FALSE: open play stuff forcing the output on a PAL screen.
  1175.  
  1176. BUGS:
  1177.  
  1178.     
  1179. NOTE:
  1180.  
  1181.     This function fails if there is not enough memory to allocate the
  1182.     required play stuff.
  1183.     Forcing a wb-like screen, can be useful for viewing animations on Amigas
  1184.     that cannot display PAL videomodes (attached to a VGA only monitor,for
  1185.     example).
  1186.     This means that xfa animations will be played according to wb display
  1187.     refresh frequency and overscan, but they may appear too much fast and
  1188.     sometimes out of the display clip boundaries.
  1189.     Under OS 3.0+ this function uses the BestModeID() when forcing a wb-like
  1190.     mode, while OS 2.0+ users (upgrade your OS !) will sometimes get worse
  1191.     results (have you upgraded ?).
  1192.     It is NOT safe to call this function if internal library-allocated XFA_Head
  1193.     and XFA_CMap structures are not correctly initialized.
  1194.  
  1195. ------------------------------------------------------------------------------
  1196.  
  1197. FUNCTION:
  1198.  
  1199.     XFA_ClosePlayStuff()
  1200.  
  1201. PROTO:
  1202.  
  1203.     void __asm __saveds LIBXFA_ClosePlayStuff(void);
  1204.  
  1205. ACTION:
  1206.  
  1207.     Frees all the stuff opened by XFA_OpenPlayStuff().
  1208.         
  1209. ARGUMENTS:
  1210.  
  1211.  
  1212. BUGS:
  1213.  
  1214.     
  1215. NOTE:
  1216.  
  1217.     It is safe to call this function, even if play stuff does not exist.
  1218.     
  1219. ------------------------------------------------------------------------------
  1220.  
  1221. FUNCTION:
  1222.  
  1223.     XFA_HeadPtr()
  1224.  
  1225. PROTO:
  1226.  
  1227.     struct XFA_Head * __asm __saveds LIBXFA_HeadPtr(void);
  1228.  
  1229. ACTION:
  1230.  
  1231.     Returns the internal library-allocated XFA_Head structure pointer.
  1232.         
  1233. ARGUMENTS:
  1234.  
  1235.  
  1236. BUGS:
  1237.  
  1238.     
  1239. NOTE:
  1240.  
  1241.     Useful to READ XFA_Head settings (WRITING into this structure is really
  1242.     dangerous, expecially having already an animation in memory).
  1243.     
  1244. ------------------------------------------------------------------------------
  1245.  
  1246. FUNCTION:
  1247.  
  1248.     XFA_CMapPtr()
  1249.  
  1250. PROTO:
  1251.  
  1252.     struct XFA_CMap * __asm __saveds LIBXFA_CMapPtr(void);
  1253.  
  1254. ACTION:
  1255.  
  1256.     Returns the internal library-allocated XFA_CMap structure pointer.
  1257.         
  1258. ARGUMENTS:
  1259.  
  1260.  
  1261. BUGS:
  1262.  
  1263.     
  1264. NOTE:
  1265.  
  1266.     Useful to READ XFA_CMap settings (WRITING into this structure is not 
  1267.     too dangerous, but can be easily avoided in order to change animation's
  1268.     palette. See XFA_SetPack() function).
  1269.         
  1270. ------------------------------------------------------------------------------
  1271.  
  1272. FUNCTION:
  1273.  
  1274.     XFA_ChangePackBitMap(bitmap)
  1275.  
  1276. PROTO:
  1277.  
  1278.     void __asm __saveds LIBXFA_ChangePackBitMap(register __a0 struct BitMap * );
  1279.  
  1280. ACTION:
  1281.  
  1282.     Changes the internal source bitmap pointer which PosOnFrame(), PutFrame(),
  1283.     PutSeqFrame() refer for packing a frame.
  1284.             
  1285. ARGUMENTS:
  1286.  
  1287.     bitmap =        pointer to the new source bitmap
  1288.  
  1289. BUGS:
  1290.  
  1291.     
  1292. NOTE:
  1293.  
  1294.     This function is here to allow the packing of double (or more) buffered
  1295.     animations (like Anim5/7/x) whose frames must be unpacked into 2 different
  1296.     bitmaps (one for the even, one for the odd frame).
  1297.     Please, refer to the examples.
  1298.         
  1299. ------------------------------------------------------------------------------
  1300.  
  1301. FUNCTION:
  1302.  
  1303.     XFA_PutSeqFrame(frame)
  1304.  
  1305. PROTO:
  1306.  
  1307.     BOOL __asm __saveds LIBXFA_PutSeqFrame(register __d0 LONG );
  1308.  
  1309. ACTION:
  1310.  
  1311.     Compresses the frame and puts it in the frames array.
  1312.     Returns TRUE if OK or FALSE if it cannot compress the frame    (no memory
  1313.     or frame out of range).
  1314.         
  1315. ARGUMENTS:
  1316.  
  1317.     frame = number of frame to work on
  1318.  
  1319. BUGS:
  1320.  
  1321.     
  1322. NOTE:
  1323.     
  1324.     The differences from XFA_PutFrame() ?
  1325.     XFA_PutFrame() in conjunction with XFA_PosOnFrame() allows easy random
  1326.     access for packing xfa animations.
  1327.     This function is here to help the handling of sequential-only problems
  1328.     like anim5/7/x to xfa conversions.
  1329.     XFA_PutFrame() does some undesired stuff that is both unuseful and
  1330.     incorrect to solve the above problem, so that's why XFA_PutSeqFrame()
  1331.     is here.
  1332.     XFA_PutSeqFrame() keeps track of the previous odd/even frames automatically,
  1333.     so there's no need for the users to do this.
  1334.     This function also prepares internal buffers for a subsequential call to
  1335.     XFA_PutSeqFrame(), so there's no need to issue a XFA_PosOnFrame() for each
  1336.     frame.
  1337.     If packmode if 16BitI or 32BitI, extra unused rasterlines will be cleared
  1338.     automatically before compressing the frame.
  1339.     Please refer to examples.
  1340.  
  1341. ------------------------------------------------------------------------------
  1342.  
  1343. FUNCTION:
  1344.  
  1345.     XFA_SaveScreen(screen,filename)
  1346.  
  1347. PROTO:
  1348.  
  1349.     LONG __asm __saveds LIBXFA_SaveScreen(register __a0 struct Screen * , register __a1 char * );
  1350.  
  1351. ACTION:
  1352.  
  1353.     Saves a standard Amiga screen in IFF-ILBM format.
  1354.     Returns 0 if OK or iff.library error code (IFFERR_#?).
  1355.         
  1356. ARGUMENTS:
  1357.  
  1358.     screen =        pointer to the screen to save
  1359.     filename =    name of the iff file to write
  1360.  
  1361. BUGS:
  1362.  
  1363.     
  1364. NOTE:
  1365.  
  1366.     This function is here for completeness.
  1367.     IFF-ILBM write code is the one furnished from CBM in NewIff39 archive.
  1368.     For this reason, I don't know if it's fully bug free or not.
  1369.     If you have faith in Carolynn Scheppner, the mother of all ilbm
  1370.     handlers .........
  1371.     
  1372. ------------------------------------------------------------------------------
  1373.  
  1374. FUNCTION:
  1375.  
  1376.     XFA_OpenRead(filename,head,cmap)
  1377.  
  1378. PROTO:
  1379.  
  1380.     struct IFFHandle * __asm __saveds LIBXFA_OpenRead(register __a0 char * , register __a1 struct XFA_Head * , register __a2 struct XFA_CMap * );
  1381.  
  1382. ACTION:
  1383.  
  1384.     This function performs the following actions:
  1385.     - opens an XFA file for reading.
  1386.     - (if file is xfa) loads XFA_Head and XFA_Cmap chunks.
  1387.     - (if file is xfa) sets current packmode for library functions.
  1388.     
  1389.     Returns a pointer to an IFFHandle struct.
  1390.     Returns NULL if it fails to open the file or if the file is not xfa.
  1391.         
  1392. ARGUMENTS:
  1393.  
  1394.     filename =    complete path and filename of source xfa file
  1395.     xfa_head =    pointer to user's allocated XFA_Head structure
  1396.                     NULL to use internal library-allocated one.
  1397.     xfa_cmap =    pointer to user's allocated XFA_CMap structure
  1398.                     NULL to use internal library-allocated one.
  1399.  
  1400. BUGS:
  1401.  
  1402.     
  1403. NOTE:
  1404.  
  1405. ------------------------------------------------------------------------------
  1406.  
  1407. FUNCTION:
  1408.  
  1409.     XFA_ReadFrame(iff,mem)
  1410.  
  1411. PROTO:
  1412.  
  1413.     LONG __asm __saveds LIBXFA_ReadFrame(register __a0 struct IFFHandle * , register __a1 struct Mem * );
  1414.  
  1415. ACTION:
  1416.  
  1417.     Reads a single xfa frame from the stream allocating enough ram to store it.
  1418.     Returns 0 if OK or iff.library error code (IFFERR_#?).
  1419.         
  1420. ARGUMENTS:
  1421.  
  1422.     iff     =    pointer to a valid IFFHandle (possibly opened with XFA_OpenRead())
  1423.     mem    =    pointer to a previously allocated mem structure where this function
  1424.                 will set all appropriate fields.
  1425.  
  1426. BUGS:
  1427.  
  1428.     
  1429. NOTE:
  1430.  
  1431.     This function allocates memory, so take care of freeing every loaded
  1432.     frame as soon as you've used it.
  1433.  
  1434. ------------------------------------------------------------------------------
  1435.  
  1436. FUNCTION:
  1437.  
  1438.     XFA_FreeFrame(mem)
  1439.  
  1440. PROTO:
  1441.  
  1442.     void __asm __saveds LIBXFA_FreeFrame(register __a0 struct Mem * );
  1443.  
  1444. ACTION:
  1445.  
  1446.     Frees a single xfa frame from memory
  1447.         
  1448. ARGUMENTS:
  1449.  
  1450.     mem    =    pointer to a previously allocated mem structure indicating the
  1451.                 frame in memory.
  1452.  
  1453. BUGS:
  1454.  
  1455.     
  1456. NOTE:
  1457.  
  1458.     As Mem structure will probabily grow or change, you are kindly requested
  1459.     to make use of this function instead of trying to free frames with your
  1460.     own code.
  1461.     This will ensure future compatibility with new releases of xfa.library.
  1462.     Internal sanity check covers only NULL mem->Ptr fields, but I have to remind
  1463.     you that all arguments are intended to be safe and consistent.
  1464.  
  1465. ------------------------------------------------------------------------------
  1466.  
  1467. <EOF>
  1468.